<template>
     <span
        style="background-color: #ffc107; border-radius: 2px;padding: 2px 3px"
        class="
    aui-text-f aui-text-center aui-ftn12
"
        :id="target"
        data-clipboard-action="copy"
        :data-clipboard-text="name"
        @click="fnCopyText(`#${target}`)"
    >
        <slot>复制</slot>
    </span>
  </template>
  
  <script>
    export default {
    name: 'Copy',
      props: ['name', 'target'],
      methods: {
        // 复制
        fnCopyText: function(el) {
            let vm = this;
            let clip = new this.clipboard(el);
            clip.on("success", function() {
                vm.utils.fnMsg("复制成功");
            });
            clip.on("error", function() {
                vm.utils.fnMsg("复制失败");
            });
        }
      },
    }
  </script>
  
  <style>
  </style>
  